To the problem of vulnerable to be attack in Wireless Sensor Network (WSN), a new security mechanism based on path sequence detection was proposed in this paper. This mechanism could detect the routing rule of packets and achieve the authentication of previous hop through constructing reasonable path sequence and sequence verification, then the correctness of routing rule and authenticity of data could be guaranteed. Performance analysis and simulation results show that the probability of the failure of data transmission path attacks detection will not decrease with the network scale. This result demonstrates that the proposed mechanism can effectively detect tampering of data transmission path attacks and can improve the security of the wireless sensor network.